#!/bin/sh

[ -e %OPTWARE_TARGET_PREFIX% ] || mkdir %OPTWARE_TARGET_PREFIX%
chmod 755 %OPTWARE_TARGET_PREFIX%
[ -e /home/.optware ] || mkdir -p /home/.optware
chmod 755 /home/.optware
if ! grep ' %OPTWARE_TARGET_PREFIX% ' /proc/mounts >/dev/null 2>&1 ; then
    mount -o bind /home/.optware %OPTWARE_TARGET_PREFIX%
fi
[ -d %OPTWARE_TARGET_PREFIX%/etc/ipkg ] || mkdir -p %OPTWARE_TARGET_PREFIX%/etc/ipkg
chmod 755 %OPTWARE_TARGET_PREFIX%/etc
[ -d %OPTWARE_TARGET_PREFIX%/var/lib ] || mkdir -p %OPTWARE_TARGET_PREFIX%/var/lib
chmod 755 %OPTWARE_TARGET_PREFIX%/var
[ -d %OPTWARE_TARGET_PREFIX%/tmp ] || mkdir -p %OPTWARE_TARGET_PREFIX%/tmp
chmod 1777 %OPTWARE_TARGET_PREFIX%/tmp
[ -d %OPTWARE_TARGET_PREFIX%/lib/ipkg/info ] || mkdir -p %OPTWARE_TARGET_PREFIX%/lib/ipkg/info
chmod 755 %OPTWARE_TARGET_PREFIX%/lib
